# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Vaporeon <vaporeon@vaporeon.io>

pkgname=rgbds
pkgver=0.6.1
pkgrel=1
pkgdesc='Rednex GameBoy Development System'
arch=(loong64 x86_64)
url=https://github.com/rednex/rgbds/
license=(MIT)
depends=(
  glibc
  libpng
)
makedepends=(
  cmake
  git
  ninja
)
_tag=69a573923f208d625df589c7a54a18738b07969c
source=(git+https://github.com/rednex/rgbds.git#tag=${_tag})
sha256sums=(SKIP)

pkgver() {
  cd rgbds

  git describe --tags | sed 's/^v//'
}

build() {
  cmake -S rgbds -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr
  ninja -C build
}

package() {
  DESTDIR="${pkgdir}" ninja -C build install
  rm -rf "${pkgdir}"/build
  install -Dm 644 rgbds/LICENSE -t "${pkgdir}"/usr/share/licenses/rgbds/
  find rgbds/contrib/zsh_compl -type f -exec install -Dm 644 {} -t "${pkgdir}"/usr/share/zsh/site-functions/ \;
}

# vim: ts=2 sw=2 et:
